var app = getApp();
const Zan = require('../../../dist/index');

Page(Object.assign({}, Zan.TopTips, {

	data: {
		cabinetNumber: null
	},

	onLoad: function (options) {
		var that = this;
		console.log(options);
		if (options.cabinetNumber != null) {
			that.setData({
				cabinetNumber: options.cabinetNumber
			});
		} else {
			//参数异常
		}
	},

	onReady: function () {

	},

	onShow: function () {

	},

	onHide: function () {

	},

	cloginSubmit(e) {
		var that = this;

		app.battery.common('sureLogin', {
			cabinetNumber: that.data.cabinetNumber,
			ticket: app.data.token,
			formId: e.detail.formId
		}).then(function (data) {
			if (!data) {
				wx.navigateBack({
					delta: 1
				})
			} else {
				that.showZanTopTips("认证失败: " + data.message, {type: 'error'});
			}
		}).catch(function (e) {
			that.showZanTopTips(e.message, {type: 'error'});
		});
	}
}));